import request from '../lib/index'



interface MenuOneTree {
  name: string
  icon: string
  order: string
}
interface MenuTree {
  name: string
  pid: string
  path: string
  icon: string
  order: string
}
interface EditMenuTree {
  name: string
  id: string
  path: string
  icon: string
  order: string
}
// 获取菜单管理列表
const getMenuList = () => {
  return request({
    url: '/menu/getMenuTree',
    method: 'post'
  })
}
// 新增一级菜单
const addOneMenu = (data: MenuOneTree) => {
  return request({
    url: '/menu/addMenu',
    method: 'post',
    data
  })
}

// 新增二级菜单
const addTwoMenu = (data: MenuTree) => {
  return request({
    url: '/menu/addMenu',
    method: 'post',
    data
  })
}
// 删除菜单
const deleteMenu = (data: any) => {
  return request({
    url: '/menu/delMenu',
    method: 'post',
    data
  })
}
// 修改菜单
const editMenu = (data: EditMenuTree) => {
  return request({
    url: 'menu/editMenu',
    method: 'post',
    data
  })
}

export { getMenuList, addTwoMenu, deleteMenu, editMenu, addOneMenu }